package com.fjnu.dao;

import com.fjnu.entity.User;
import com.fjnu.dto.UserConditionDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface UserDao {
    int insert(User newUser);
    int insertUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
    int batchInsertUserRoles(@Param("userId") Integer userId, @Param("roleIds") List<Integer> roleIds);
    int updatePassword(@Param("userId") Integer userId, @Param("newPassword") String newPassword);
    int updateScore(@Param("userId") Integer userId, @Param("incrementedScore") Long incrementedScore);
    User selectByNameAndPwd(@Param("username") String username, @Param("password") String password);
    List<User> selectByCondition(UserConditionDto userCondition);
    List<User> selectByConditionWithLimit(@Param("condition") UserConditionDto userCondition,
                                          @Param("startIndex") Integer startIndex,
                                          @Param("endIndex") Integer endIndex);
    User selectById(Integer id);
    int countByCondition(UserConditionDto userCondition);
}